package com.vo;

import com.bean.Provider;
import com.util.DateUtil;
import org.springframework.util.Assert;

import java.io.Serializable;

public class ProviderVo implements Serializable {


    private String id;
    /*供货商名称*/
    private String name;
    /*法人名字*/
    private String boss;
    /*法人电话*/
    private String phone;
    /*公司地址*/
    private String address;
    /*公司传真*/
    private String faxNum;
    /*公司成立日期*/
    private String createDay;
    /*公司描述*/
    private String description;

    public Provider back() throws Exception {

        Provider provider = new Provider();

        try {
            if(this.id != null) {
                provider.setId(Integer.valueOf(this.id));
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
        try {
            if(this.createDay != null) {
                provider.setCreateDay(DateUtil.parse(this.createDay));
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        provider.setName(this.name);
        provider.setBoss(this.boss);
        provider.setPhone(this.phone);
        provider.setAddress(this.address);
        provider.setFaxNum(this.faxNum);
        provider.setDescription(this.description);

        return provider;
    }





    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBoss() {
        return boss;
    }

    public void setBoss(String boss) {
        this.boss = boss;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getFaxNum() {
        return faxNum;
    }

    public void setFaxNum(String faxNum) {
        this.faxNum = faxNum;
    }

    public String getCreateDay() {
        return createDay;
    }

    public void setCreateDay(String createDay) {
        this.createDay = createDay;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return "ProviderVo{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", boss='" + boss + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", faxNum='" + faxNum + '\'' +
                ", createDay='" + createDay + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}
